<template lang="jade">
div.report-list
  ul(v-infinite-scroll="down()")
    li(v-for="(index, item) in items")
      a(v-link="{ name: 'report', params: { reportId: item.apply_id } }")
        strong {{item.name}}
        em {{ item.initial_assess_time }}
</template>

<script>
import '../assets/sass/detail/report-list.scss'
import {Api_Report_List} from '../config/api'

export default {

  data () {
    return {
      busy: false,
      page: 1,
      items: [],
    }
  },
  methods: {
    down: function() {
      if(this.busy == true || this.items == ''){
        return false;
      } 
      this.busy = true;
      this.fetch(++this.page)
    },
    fetch: function (page) {
      var data = {'page': page}
      this.$http({url: Api_Report_List+'&page='+page, method: 'GET'}).then(function (response) {
        this.items = this.items.concat(response.data.data) 
      });
    },
  },
  route: {
    activate ( transition ) {
      this.fetch(1)
      transition.next();
    }
  }
}
</script>